<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--生成器是一个特殊的函数-->
<!--异步编程,纯回调函数-->
<script>
    //yield 看作函数代码的分隔符
    function* gen() {
        yield 'hello,world'
        yield 'hello,world2'
        yield 'hello,world3'
    }

    let iterator = gen();
    for (let v of iterator) {
        console.log(v)
    }
</script>
</body>
</html>
